<?php
//横幅
class App_Banner extends Data_Base
{
	//获取横幅
    public static function items ($shopId = NULL)
    {
        $where = NULL;

        $items = self::lists('banner_list', $where, array('sort', 'asc'), 0, 15);
        foreach ($items as & $rs)
        {
            $url = $rs['url'];
            $url = trim($url, '/');
            if (! preg_match ('/^http:\/\//', $url))
            {
                $url = 'http://'.$_SERVER['HTTP_HOST'].'/'.$url;
                $rs['url'] = $url;
            }
        }

        return $items;
    }

	//获取横幅
    public static function centerBanneritems ($shopId = NULL)
    {
        $where = NULL;

        $items = self::lists('banner_list_center', $where, array('sort', 'asc'), 0, 15);
        foreach ($items as & $rs)
        {
            $url = $rs['url'];
            $url = trim($url, '/');
            if (! preg_match ('/^http:\/\//', $url))
            {
                $url = 'http://'.$_SERVER['HTTP_HOST'].'/'.$url;
                $rs['url'] = $url;
            }
        }

        return $items;
    }

}
